package com.bizteco.policelogviewer;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;
import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
import org.eclipse.ui.application.WorkbenchWindowAdvisor;

import com.bizteco.policelogviewer.utils.MiscUtil;

public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {

	public ApplicationWorkbenchWindowAdvisor(IWorkbenchWindowConfigurer configurer) {
		super(configurer);
	}

	public ActionBarAdvisor createActionBarAdvisor(
			IActionBarConfigurer configurer) {
		return new ApplicationActionBarAdvisor(configurer);
	}

	public void preWindowOpen() {
		IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
		
		configurer.setInitialSize(new Point(400, 300));
		configurer.setShowCoolBar(false);
		configurer.setShowStatusLine(false);
		
		// Centering WorkbenchWindows.
        MiscUtil.setShellCenter( PlatformUI.getWorkbench().getDisplay(), configurer.getWindow().getShell());
        
        DBConnectDialog dialog = new DBConnectDialog( this.getWindowConfigurer().getWindow().getShell(), SWT.NONE);
		dialog.open();
        
//        configurer.setShowFastViewBars(true);
	}
	
//	public void postWindowOpen() {
//		DBConnectDialog dialog = new DBConnectDialog( this.getWindowConfigurer().getWindow().getShell(), SWT.NONE);
//		dialog.open();
//	}
	
//	public void openIntro() {
//		DBConnectDialog dialog = new DBConnectDialog( this.getWindowConfigurer().getWindow().getShell(), SWT.NONE);
//		dialog.open();
//	}
	
//	public void postWindowCreate() {
//		DBConnectDialog dialog = new DBConnectDialog( this.getWindowConfigurer().getWindow().getShell(), SWT.NONE);
//		dialog.open();
//	}
}
